package cn.iocoder.yudao.module.infra.repository.mybatis.dao.file;

import cn.iocoder.yudao.common.pojo.PageResult;
import cn.iocoder.yudao.core.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.core.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.repository.mybatis.domain.file.File;
import cn.iocoder.yudao.module.infra.vo.file.file.FilePageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 文件操作 Mapper
 */
@Mapper
public interface FileMapper extends BaseMapperX<File> {

    default PageResult<File> selectPage(FilePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<File>()
                .likeIfPresent(File::getPath, reqVO.getPath())
                .likeIfPresent(File::getType, reqVO.getType())
                .betweenIfPresent(File::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(File::getId));
    }

}
